<div bsModal #createOrEditModal="bs-modal" (onShown)="onShown()" aria-labelledby="createOrEditModal" class="modal fade"
    tabindex="-1" role="dialog" aria-hidden="true" [config]="{backdrop: 'static'}">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <form *ngIf="active" #deviceTypeForm="ngForm" name="DeviceTypeForm" novalidate (ngSubmit)="save()"
                autocomplete="off">
                <div class="modal-header">
                    <h4 class="modal-title">
                        <span *ngIf="deviceType?.id">{{l("EditDeviceType")}}:
                            {{deviceType?.id+' | '+deviceType?.name}}</span>
                        <span *ngIf="!deviceType.id">{{l("CreateNewDeviceType")}}</span>
                    </h4>
                    <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')">
                        <i aria-hidden="true" class="ki ki-close"></i>
                    </button>
                </div>
                <div class="modal-body">
                    <tabset class="tab-container tabbable-line">
                        <tab heading="{{l('DeviceTypeMsg')}}" customClass="kt-tabs__item">
                            <div class="row">
                                <div class="col-12">
                                    <div class="form-group">
                                        <label>{{l("Name")}} *</label>
                                        <input #nameInput="ngModel" class="form-control" type="text" name="Name"
                                            [(ngModel)]="deviceType.name" required maxlength="32">
                                        <validation-messages [formCtrl]="nameInput"></validation-messages>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label">{{l("Picture")}} *</label>
                                        <app-fileupload [fileUrl]="deviceType.iconUrl"
                                            (onUpLoadEvent)="onUpload($event)"
                                            (onBeforeSendEvent)="onBeforeSend($event)"></app-fileupload>
                                    </div>
                                </div>
                            </div>




                            <div class="row">
                                <div class="form-group col-4" style="position:relative;margin:1rem 0;"
                                    *ngFor="let ability of abilities">
                                    <label class="checkbox checkbox-primary" style="position:absolute;top:50%;">
                                        <input [(ngModel)]="ability.active" type="checkbox"
                                            [name]="ability.name" />{{l(ability.name)}}
                                        <span></span>
                                    </label>
                                </div>
                            </div>

                            <br>

                            <div class="row" *ngIf="abilities[6].active">
                                <div class="form-group col-3" style="position:relative;margin:1rem 0;"
                                    *ngFor="let controlItem of controlItems">
                                    <label class="checkbox checkbox-primary" style="position:absolute;top:50%;">
                                        <input [(ngModel)]="controlItem.active" type="checkbox"
                                            [name]="controlItem.name" />{{l(controlItem.name)}}
                                        <span></span>
                                    </label>
                                </div>
                            </div>


                        </tab>
                    </tabset>
                </div>
                <div class="modal-footer">
                    <button [disabled]="saving" type="button" class="btn btn-primary"
                        (click)="close()">{{l("Cancel")}}</button>
                    <button type="submit" class="btn btn-primary blue" [disabled]="!deviceTypeForm.form.valid"
                        [buttonBusy]="saving" [busyText]="l('SavingWithThreeDot')"><i class="fa fa-save"></i>
                        <span>{{l("Save")}}</span></button>
                </div>
            </form>
        </div>
    </div>
</div>